package com.care.system.server.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;

import com.care.system.common.domain.TRecord;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.care.common.log.annotation.Log;
import com.care.common.log.enums.BusinessType;
import com.care.common.security.annotation.RequiresPermissions;
import com.care.system.common.domain.TPurse;
import com.care.system.server.service.ITPurseService;
import com.care.common.core.web.controller.BaseController;
import com.care.common.core.domain.Result;
import com.care.common.core.utils.poi.ExcelUtil;
import com.care.common.core.web.page.TableDataInfo;

/**
 * 我的钱包Controller
 *
 * @author 李光耀负责
 * @date 2024-03-25
 */
@RestController
@RequestMapping("/purse")
public class TPurseController extends BaseController
{
    @Autowired
    private ITPurseService tPurseService;


    @PostMapping("/purseList")
    public Result<TPurse> purseList(@RequestParam("userId")Long userId){
        Result<TPurse> result = tPurseService.selectPurseListByUserId(userId);
        return result;
    }


    /**
     * 删除我的钱包
     */
    @RequiresPermissions("system:purse:remove")
    @Log(title = "我的钱包", businessType = BusinessType.DELETE)
	@DeleteMapping("/{purseIds}")
    public Result remove(@PathVariable Long[] purseIds)
    {
        return toAjax(tPurseService.deleteTPurseByPurseIds(purseIds));
    }
}
